import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * @Author: Lenovo
 * @Date: 2024/7/23 9:50
 * @description:
 */
class IntCmp implements Comparator<Integer>{
    @Override
    public int compare(Integer o1, Integer o2) {
        return o2.compareTo(o1);
    }
}
public class Test {
    public static void main(String[] args) {
        PriorityQueue<Integer> priorityQueue= new PriorityQueue<>(new IntCmp());
        priorityQueue.offer(10);
        priorityQueue.offer(12);
        priorityQueue.offer(5);
        System.out.println(priorityQueue.peek());
    }
    public static void main2(String[] args) {
        PriorityQueue<Integer> priorityQueue= new PriorityQueue<>();
        priorityQueue.offer(10);
        priorityQueue.offer(12);
        priorityQueue.offer(5);
        System.out.println(priorityQueue.peek());//说明是小根堆
    }
    public static void main1(String[] args) {
        TestHeap testHeap = new TestHeap();
        int[] array = {27,15,19,18,28,34,65,49,25,37 };
        testHeap.initElem(array);
        testHeap.createHeap();
        testHeap.offer(80);
    }

}

